package com.jingdong.dao.productType.impl;

import com.jingdong.dao.productType.ProductTypeTwoDao;
import com.jingdong.model.Product_type_two;
import com.jingdong.utils.MyBatisUtils;
import org.apache.ibatis.jdbc.SQL;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ProductTypeTwoDaoImpl implements ProductTypeTwoDao {
    @Override
    public List<Product_type_two> twoTypeList(int typeOneId) {
        try{
            SqlSession sqlSession= MyBatisUtils.getSqlSession();
            List<Product_type_two> type_twoList=sqlSession.selectList("com.jingdong.productTypeTwoModel.list",typeOneId);
            return  type_twoList;
        }catch (Exception e){
            e.printStackTrace();
        }

        return null;
    }

    @Override
    public Product_type_two getById(Long typeThreeId) {
        try{
            SqlSession sqlSession=MyBatisUtils.getSqlSession();
            Product_type_two type_two=sqlSession.selectOne("com.jingdong.productTypeTwoModel.getById",typeThreeId);
            sqlSession.close();
            return type_two;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
